

<?


class CTRLsocial extends CONTROL {

	function __construct( $vars ) {
		global $Object;
		
		$this->_addvars( $vars );

		if( $this->action != "list" )
			$Object = $this->create_object();
		
	}
	
#	Create social object.
	function create_object() {
		global $Engine, $Object;
		
		$class = strtoupper( array_pop( explode( ".", $Engine->request->type, 2 )));
		
		return $Object = ( $this->action == "new" )?
			new $class( $this->vars, 0 ) : new $class( $this->vars );
	
	}
	
#	Shift (alter column value).
	function filter_ajax() {
		global $DB, $Request;
		
		if( $Request->vars->requestfunc )
			$comment = $this->{ $Request->vars->requestfunc }();
		
		else 
			$comment = ( $Request->ajax() )? "option modified":"warning: failed";

		return $this->comment( $comment );
	}
	
#	Social function: publish	
	function publish() {
		global $Request, $Object;
		
		if ($Request->vars->value == 1) 
			return $Object->publish( $Request->vars );
			
		else 
			return $Object->unpublish( $Request->vars );
		
	}
	

}




?>





